import request from "@/utils/request";
import { getToken, getUserId, getSiteId } from "@/utils/auth";

// 商品类型查询
export function seriesQueryApi(params = { keyStr: "", pageNum: 1, pageSize: 10 }) {
  return request({
    url: "/SeriesQueryV3/GetSeriesList",
    method: "get",
    params: {
      KeyStr: params.keyStr,
      AccessToken: getToken(),
      SiteId: getSiteId(),
      PageIndex: params.pageNum,
      PageSize: params.pageSize
    },
  });
}


// 商品类型增改，BrandId=0新增，否则修改
export function seriesUpdateApi(data =
  {
    SeriesId: 0,
    SeriesName: "",
    SeriesAvatar: "",
    ProductTypeName: "",
    BrandName: "",
    RecommandPrice: "",
    RecommandLevel: "",
    SalesVolume: ""
  }) {
  return request({
    url: "/SeriesAddV3/Post",
    method: "post",
    data: {
      SeriesId: data.SeriesId,
      SeriesName: data.SeriesName,
      SeriesAvatar: data.SeriesAvatar,
      ProductTypeName: data.ProductTypeName,
      BrandName: data.BrandName,
      RecommandPrice: data.RecommandPrice,
      RecommandLevel: data.RecommandLevel,
      SalesVolume: data.SalesVolume,
      AccessToken: getToken(),
      SiteId: getSiteId(),
    },
  });
}

// 商品类型删除
export function seriesRemoveApi(SeriesIds = []) {
  return request({
    url: "/SeriesDeleteV3/Post",
    method: "post",
    data: {
      SeriesIds: SeriesIds.join(','),
      AccessToken: getToken(),
      SiteId: getSiteId(),
    },
  });
}